package com.jiesen.base.modules.certificate.jsUser.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.time.LocalDate;
import java.time.LocalDateTime;

@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class JsUserDTO {

    //主表内容
    private String id;
    private Integer sort;  //"序号"
    private Integer branchOffice;  //"分公司：1鄂尔多斯市、2包头市、3榆林市"
    private String name;  //"学员姓名"
    private Integer sex;  //"性别:0女、1男"
    private String telphone;  //"手机号"
    private String identityCard;  //"身份证号"
    private Integer type;  //"客户类型:0面谈客户、1电销客户、-1官网注册"
    private String headPortrait;  //"头像"
    private Integer lock;  //"是否锁定：1可用、0锁定、-1未激活"
    private String password;  //"密码"
    private String salt;  //"盐"
    private String code;  //"code"
    private Integer headmasterId;  //"班主任"
    private String headmasterName;  //"班主任名称"

    //明细表内容
    private String detailId;
    private String userMainId;  //关联用户id
    private Integer age;  //"年龄"
    private String birthday;  //"生日"
    private String idPhotoA;  //"身份证头像面"
    private String idPhotoB;  //"身份证国徽面"
    private String diploma;  //"毕业证"
    private Integer createAt;  //"创建时间"
    private String describe;  //"备注"
    private LocalDateTime uts;  //"修改时间"
    private LocalDateTime cts;  //"注册时间"
    private String origin;  //"来源"
    private String birthplace;  //"户口所在地"
    private String politicCountenance;  //"政治面貌"
    private String nation;  //"名族"
    private String accountNature;  //"户口性质：0农村户、1城市户"
    private String email;  //"电子邮件"
    private String maritalStatus;  //"婚姻状况：0未婚、1已婚"
    private String nativePlace;  //"籍贯"
    private String xuexinName;  //"学信网用户名"
    private String xuexinPassword;  //"学信网密码"
    private String major;  //"报名专业"
    private String educationLevel;  //"报考层次:1中专升大专、2高起专、3专升本"
    private String address;  //"住址"
    private String addressTelephone;  //"住址电话"
    private String workUnit;  //"工作单位"
    private String workTelephone;  //"工作单位电话"
    private String highestEducation;  //"原最高学历"
    private String oldGraduateSchool;  //"原毕业学校"
    private String oldGraduateDate;  //"原毕业时间"
    private String oldGraduationCertificateNo;  //"原毕业证书编号"
    private String workExperience;  //"工作经验"
    private String familyMember;  //"家庭成员"
    private String oldGraduateLevel;  //"原毕业级别"
    private LocalDate studentDate;  //"出生日期"
    private String studentEducation;  //"学历"
    private String studentMailingAddress;  //"邮寄地址"
    private String studentPostcode;  //"邮编"
    private String studentFixedLineTelephone;  //"固定电话"
    private String studentEmergency;  //"紧急联系人"
    private String studentEmergencyTelephone;  //"紧急联系人电话"
    private String studentQqWechatId;  //"qq号/微信号"


    public JsUserDTO(JsUser jsUser, JsUserDetail jsUserDetail) {
        this.id = jsUser.getId();
        this.sort = jsUser.getSort();
        this.branchOffice = jsUser.getBranchOffice();
        this.name = jsUser.getName();
        this.sex = jsUser.getSex();
        this.telphone = jsUser.getTelphone();
        this.identityCard = jsUser.getIdentityCard();
        this.type = jsUser.getType();
        this.headPortrait = jsUser.getHeadPortrait();
        this.lock = jsUser.getLock();
        this.password = jsUser.getPassword();
        this.salt = jsUser.getSalt();
        this.code = jsUser.getCode();
        this.headmasterId = jsUser.getHeadmasterId();
        this.headmasterName = jsUser.getHeadmasterName();



        this.detailId = jsUserDetail.getId();
        this.userMainId = jsUserDetail.getUserMainId();
        this.age = jsUserDetail.getAge();
        this.birthday = jsUserDetail.getBirthday();
        this.idPhotoA = jsUserDetail.getIdPhotoA();
        this.idPhotoB = jsUserDetail.getIdPhotoB();
        this.diploma = jsUserDetail.getDiploma();
        this.createAt = jsUserDetail.getCreateAt();
        this.describe = jsUserDetail.getDescribe();
        this.uts = jsUserDetail.getUts();
        this.cts = jsUserDetail.getCts();
        this.origin = jsUserDetail.getOrigin();
        this.birthplace = jsUserDetail.getBirthplace();
        this.politicCountenance = jsUserDetail.getPoliticCountenance();
        this.nation = jsUserDetail.getNation();
        this.accountNature = jsUserDetail.getAccountNature();
        this.email = jsUserDetail.getEmail();
        this.maritalStatus = jsUserDetail.getMaritalStatus();
        this.nativePlace = jsUserDetail.getNativePlace();
        this.xuexinName = jsUserDetail.getXuexinName();
        this.xuexinPassword = jsUserDetail.getXuexinPassword();
        this.major = jsUserDetail.getMajor();
        this.educationLevel = jsUserDetail.getEducationLevel();
        this.address = jsUserDetail.getAddress();
        this.addressTelephone = jsUserDetail.getAddressTelephone();
        this.workUnit = jsUserDetail.getWorkUnit();
        this.workTelephone = jsUserDetail.getWorkTelephone();
        this.highestEducation = jsUserDetail.getHighestEducation();
        this.oldGraduateSchool = jsUserDetail.getOldGraduateSchool();
        this.oldGraduateDate = jsUserDetail.getOldGraduateDate();
        this.oldGraduationCertificateNo = jsUserDetail.getOldGraduationCertificateNo();
        this.workExperience = jsUserDetail.getWorkExperience();
        this.familyMember = jsUserDetail.getFamilyMember();
        this.oldGraduateLevel = jsUserDetail.getOldGraduateLevel();
        this.studentDate = jsUserDetail.getStudentDate();
        this.studentEducation = jsUserDetail.getStudentEducation();
        this.studentMailingAddress = jsUserDetail.getStudentMailingAddress();
        this.studentPostcode = jsUserDetail.getStudentPostcode();
        this.studentFixedLineTelephone = jsUserDetail.getStudentFixedLineTelephone();
        this.studentEmergency = jsUserDetail.getStudentEmergency();
        this.studentEmergencyTelephone = jsUserDetail.getStudentEmergencyTelephone();
        this.studentQqWechatId = jsUserDetail.getStudentQqWechatId();
    }

    @JsonIgnore
    public JsUser getJsUser(){
        JsUser jsUser = new JsUser();
        jsUser.setId(this.id);
        jsUser.setSort(this.sort);
        jsUser.setBranchOffice(this.branchOffice);
        jsUser.setName(this.name);
        jsUser.setSex(this.sex);
        jsUser.setTelphone(this.telphone);
        jsUser.setIdentityCard(this.identityCard);
        jsUser.setType(this.type);
        jsUser.setHeadPortrait(this.headPortrait);
        jsUser.setLock(this.lock);
        jsUser.setPassword(this.password);
        jsUser.setSalt(this.salt);
        jsUser.setCode(this.code);
        jsUser.setHeadmasterId(this.headmasterId);
        jsUser.setHeadmasterName(this.headmasterName);
        return jsUser;
    }

    @JsonIgnore
    public JsUserDetail getJsUserDetail(){
        JsUserDetail jsUserDetail = new JsUserDetail();
        jsUserDetail.setId(this.detailId);
        jsUserDetail.setUserMainId(this.id);            //这里提取主表的主键
        jsUserDetail.setAge(this.age);
        jsUserDetail.setBirthday(this.birthday);
        jsUserDetail.setIdPhotoA(this.idPhotoA);
        jsUserDetail.setIdPhotoB(this.idPhotoB);
        jsUserDetail.setDiploma(this.diploma);
        jsUserDetail.setCreateAt(this.createAt);
        jsUserDetail.setDescribe(this.describe);
        jsUserDetail.setUts(this.uts);
        jsUserDetail.setCts(this.cts);
        jsUserDetail.setOrigin(this.origin);
        jsUserDetail.setBirthplace(this.birthplace);
        jsUserDetail.setPoliticCountenance(this.politicCountenance);
        jsUserDetail.setNation(this.nation);
        jsUserDetail.setAccountNature(this.accountNature);
        jsUserDetail.setEmail(this.email);
        jsUserDetail.setMaritalStatus(this.maritalStatus);
        jsUserDetail.setNativePlace(this.nativePlace);
        jsUserDetail.setXuexinName(this.xuexinName);
        jsUserDetail.setXuexinPassword(this.xuexinPassword);
        jsUserDetail.setMajor(this.major);
        jsUserDetail.setEducationLevel(this.educationLevel);
        jsUserDetail.setAddress(this.address);
        jsUserDetail.setAddressTelephone(this.addressTelephone);
        jsUserDetail.setWorkUnit(this.workUnit);
        jsUserDetail.setWorkTelephone(this.workTelephone);
        jsUserDetail.setHighestEducation(this.highestEducation);
        jsUserDetail.setOldGraduateSchool(this.oldGraduateSchool);
        jsUserDetail.setOldGraduateDate(this.oldGraduateDate);
        jsUserDetail.setOldGraduationCertificateNo(this.oldGraduationCertificateNo);
        jsUserDetail.setFamilyMember(this.familyMember);
        jsUserDetail.setOldGraduateLevel(this.oldGraduateLevel);
        jsUserDetail.setStudentDate(this.studentDate);
        jsUserDetail.setStudentEducation(this.studentEducation);
        jsUserDetail.setStudentMailingAddress(this.studentMailingAddress);
        jsUserDetail.setStudentPostcode(this.studentPostcode);
        jsUserDetail.setStudentFixedLineTelephone(this.studentFixedLineTelephone);
        jsUserDetail.setStudentEmergency(this.studentEmergency);
        jsUserDetail.setStudentEmergencyTelephone(this.studentEmergencyTelephone);
        jsUserDetail.setStudentQqWechatId(this.studentQqWechatId);
        return jsUserDetail;
    }
}
